package com.yexiong.server.process;

import java.io.IOException;

import com.common.entity.DataPack;
import com.common.entity.Employee;
import com.common.server.view.ServerMainFrame;
import com.common.server.view.ServerProcessThread;
import com.common.server.view.ServiceProcess;
import com.yexiong.dao.impl.EmployeeDaoImpl;


public class LoginServiceProcess implements ServiceProcess{

	@Override
	public Object service(DataPack dataPack, ServerProcessThread serverProcessThread, ServerMainFrame serverMainFrame)
			throws IOException {
		if ("login".equals(dataPack.getOptType())) {
			EmployeeDaoImpl employeeDaoImpl=new EmployeeDaoImpl();
			boolean is=employeeDaoImpl.judegLogin((Employee)dataPack.getCon());
			if (is) {
				serverProcessThread.getOos().writeObject(dataPack.getCon());
			}else {
				serverProcessThread.getOos().writeObject(null);
			}
			
		}
		return null;
	}

}
